
/******************************************************************************
 * Copyright Cambridge Silicon Radio Limited 2014 - 2015.
 ******************************************************************************/


package com.ihomey.linkuphome.entities;

public abstract class Device {
    // Addresses in the range 0x0000 - 0x7FFF are intended for groups.
    public static final int GROUP_ADDR_BASE = 0x0000;
    // Addresses from 0x8000 to 0xFFFF are intended for addressing individual devices.
    public static final int DEVICE_ADDR_BASE = 0x8000;

    public static final int DEVICE_ID_UNKNOWN = 0x10000;

    private int mDeviceId;
    private int mDeviceType;
    private String mName;

    public Device() {
    }

    public Device(String mName) {
        this.mName = mName;
    }


    // Keys used for json
    static final String JSON_KEY_ID = "id";
    static final String JSON_KEY_UUID_HASH = "uuid_hash";
    static final String JSON_KEY_NAME = "name";
    static final String JSON_KEY_IS_GROUP = "is_group";
    static final String JSON_KEY_GROUP_MEMBERSHIP = "group_membership";
    static final String JSON_KEY_MODEL_SUPPORT_LOW = "model_low";
    static final String JSON_KEY_MODEL_SUPPORT_HIGH = "model_high";

    public Device(int deviceId, int deviceType, String name) {
        this.mDeviceId = deviceId;
        this.mDeviceType = deviceType;
        this.mName = name;
    }

    public Device(int deviceType, String name) {
        this.mDeviceType = deviceType;
        this.mName = name;
    }

    /**
     * Copy constructor
     *
     * @param other
     *            Device object to make a copy of.
     */
    public Device(Device other) {
        this.mDeviceId = other.mDeviceId;
        this.mDeviceType = other.mDeviceType;
        this.mName = other.mName;
    }

    /**
     * Copy another device object's fields into this object.
     *
     * @param other
     *            Device object to copy.
     */
    public void copy(Device other) {
        this.mDeviceId = other.mDeviceId;
        this.mDeviceType = other.mDeviceType;
        this.mName = other.mName;
    }

    public int getDeviceId() {
        return mDeviceId;
    }

    public void setDeviceId(int deviceId) {
        this.mDeviceId = deviceId;
    }

    public int getDeviceType() {
        return mDeviceType;
    }

    public void setDeviceType(int mDeviceType) {
        this.mDeviceType = mDeviceType;
    }

    public String getName() {
        return mName;
    }

    public void setName(String name) {
        this.mName = name;
    }

}
